<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
//环境配置
Route::get('/', function () {
    // return view('welcome');
	$webName = config('app.webName');
	// return $webName;
    return view('welcome');
});

//命名路由
// Route::get('user/profile', ['as' => 'profile', function () {
//     return route('profile');
// }]);
// 指定名称到控制器
// Route::get('user/profile', [
//     'as' => 'profile',
//     'uses' => 'UserController@showProfile'
// ]);

// Route::get('user/profile', 'UserController@showProfile')->name('profile');
//路由群组和命名路由
// Route::get('/user/add','UserController@add');
// Route::get('/user/delete','UserController@delete');
// Route::group(['prefix' => 'user'], function(){
//     Route::get('/add', 'UserController@add');
//     Route::get('/delete', 'UserController@delete');
// });

//命名空间
// Route::group(['prefix' => '/admin/user','namespace' => 'Admin'],function(){
//     Route::get('/add', 'UserController@add');
//     Route::get('/delete', 'UserController@delete');
// });
//书写ajax
// Route::get('/ajax/html', function(){
//     return view('ajaxhtml');
// });
// Route::post('/ajax', function(){
//     return 111;
// });
// Route::get('404',function(){
//     abort(404);
// });


Route::get('/form', function(){
    return view('form');
});

// Route::post('/login',['middleware' => 'login', function(){
//     return '登录成功';
// }]);

// Route::post('/login',['middleware' => 'login', 'uses' => 'Admin\UserController@login']);
// Route::post('login', 'Admin\UserController@login');
// Route::get('admin/user/add',"Admin\UserController@add");
// Route::get('admin/user/insert',"Admin\UserController@insert");
// Route::get('admin/user/edit',"Admin\UserController@edit");
// Route::get('admin/user/update',"Admin\UserController@update");
// Route::get('admin/user/delete',"Admin\UserController@delete");
// Route::get('admin/user/index',"Admin\UserController@index");
// Route::get('admin/user/detail',"Admin\UserController@detail");


// Route::resource('photos','Admin\PhotosController',['names' => ['create' => 'build']]);

//请求
// Route::post('/request/test','Admin\RequestController@test');
// Route::get('/request/cookie','Admin\RequestController@cookie');
// Route::get('/request/wcookie','Admin\RequestController@wcookie');
//
// 上传文件
// Route::post('/request/file','Admin\RequestController@file');
//
//响应
// Route::get('/response/str',function(){
//     return response('Hello World') -> header('Content-Type','zhangsan')
//     -> header('name','wangwu')
//     -> header('age','18');
// });

//响应一个视图解析模板
// Route::get('response/view',function(){
//     $data = array('name' => '张三','age' => 18);
//     // return view('welcome',$data);
//     return view('welcome',['data' => $data]);
// });
//下载
// Route::get('/response/json',function(){
//     return response() -> json(['name' => 'cuiyanhui','state' => 'abc']);
// });
// 下载
// Route::get('/response/download',function(){
//     return response() -> download('./uploads/147901772774084.png');
// });

//重定向
// Route::get('/response/sess',function(){
//     return redirect('/') -> with('name','张三');
// });
//
//使用自定义函数
//1.创建一个自定义的文件
//2.在composer.json 添加自动加载文件
//"autoload": {
    //     "classmap": [
    //         "database"
    //     ],
    //     "psr-4": {
    //         "App\\": "app/"
    //     },
    //     "files":[
    //         "app/common/functions.php"
    //     ]
    // },
//3.在命令行执行composer dump-auto
//或者composer dump-autoload
// Route::get('/test', function(){
//     myTest();
// });
//
//
// 使用自定义类
Route::get('/girl','Admin\TestController@test');